<!DOCTYPE html>
<!-- 产品配置界面 -->
<html lang="en">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta charset="utf-8" />
<title>驴妈妈统计系统</title>
<meta name="description" content="overview &amp; stats" />
<meta name="viewport"
	content="width=device-width, initial-scale=1.0, maximum-scale=1.0" />
<!-- bootstrap & fontawesome -->
<link rel="stylesheet" href="${request.contextPath}/static/assets/css/bootstrap.min.css" />
<link rel="stylesheet" href="${request.contextPath}/static/assets/css/bootstrap.css" />
<link rel="stylesheet" href="${request.contextPath}/static/assets/css/loading-incr.css" />
<link rel="stylesheet"
	href="${request.contextPath}/static/assets/font-awesome/4.5.0/css/font-awesome.min.css" />
<!-- page specific plugin styles -->
<link rel="stylesheet" href="${request.contextPath}/static/assets/css/jquery.gritter.min.css" />
<!-- text fonts -->
<link rel="stylesheet" href="${request.contextPath}/static/assets/css/fonts.googleapis.com.css" />
<!-- ace styles -->
<link rel="stylesheet" href="${request.contextPath}/static/assets/css/ace.min.css"
	class="ace-main-stylesheet" id="main-ace-style" />
<link rel="stylesheet" href="${request.contextPath}/static/assets/css/ace-skins.min.css" />
<link rel="stylesheet" href="${request.contextPath}/static/assets/css/ace-rtl.min.css" />
<link rel="stylesheet" href="${request.contextPath}/static/stylesheets/daterangepicker.css">
<link rel="stylesheet" href="${request.contextPath}/static/assets/css/bootstrap-datepicker3.min.css">
<script src="${request.contextPath}/assets/js/jquery-2.1.4.min.js"></script>
<style type="text/css">
.upload{
    padding: 4px 10px;
    height: 34px;
    line-height: 38px;
    position: relative;
    border: 1px solid #D6487E;
    text-decoration: none;
    color: white;
}
.change{
    position: absolute;
    overflow: hidden;
    right: 0;
    top: 0;
    opacity: 0;
}
.txt{ height:34px; border:1px solid #cdcdcd; width:180px;}
.view{ background-color:#D6487E; border:1px solid #CDCDCD;height:34px; width:70px;color:white}

.file {
    position: absolute;
    top: 14px;
    right: 120px;
    height: 34px;
    filter: alpha(opacity:0);
    opacity: 0;
    width: 70px;
}
/* 模态框居中样式 */
 .modal-dialog {
 	top:10%;
 }
  .page-content{padding: 0px 0px 0px!important;}
  .ace-icon{cursor: pointer;}
  
</style>
</head>
<body class="skin-2" style="background-color: #FFF;" id="loadingdiv">
		<div class="page-content">
			<div class="tabbable">
				<div class="tab-content">
				   <div id="manage" class="tab-pane active in">
					<div class="row">
						<div class="col-xs-12">
								<div class="widget-box">
									<div class="widget-body" style="background-color: #EFF3F8;">
										<div class="widget-main">											
											<form class="form-inline" id="searchForm" method="post" action="${request.contextPath}/backConfig/prodConfig">
											<input type="hidden" id="_csrf" name="${_csrf.parameterName}" value="${_csrf.token}" />
												<div class="form-group" style="width: 100%;">
													<label  for="exampleInputName">产品ID
														<input class="form-control" name="productId" id="QueryProductId" value="<#if LMMCareProductVO??&&LMMCareProductVO.productId??>${LMMCareProductVO.productId}</#if>" placeholder="模糊查询产品ID" type="text" style="width:123px">
													</label>
													<label  for="exampleInputName" style="margin-left: 30px;">产品名称
														<input class="form-control" name="productName" id="QueryProductName" value="<#if LMMCareProductVO??&&LMMCareProductVO.productName??>${LMMCareProductVO.productName}</#if>" placeholder="模糊查询产品名称" type="text" style="width:123px">
													</label>
													<label  for="exampleInputName" style="margin-left: 30px;">所属城市
														<input class="form-control" name="cityName" id="QueryCityName" value="<#if LMMCareProductVO??&&LMMCareProductVO.cityName??>${LMMCareProductVO.cityName}</#if>" placeholder="模糊查询所属城市" type="text" style="width:123px" style="width:123px">
													</label>
													<label  for="exampleInputName" style="margin-left: 30px;">业务编码
														<select name="businessCode" id="businessCodeSearch" aria-controls="dynamic-table" class="form-control input-sm" style="width:80px;height:34px">
														      <#if LMMCareProductVO??&&LMMCareProductVO.businessCode??&&LMMCareProductVO.businessCode=="TICKET"><option value="TICKET" selected>门票</option><#else><option value="TICKET">门票</option></#if>
														      <#if LMMCareProductVO??&&LMMCareProductVO.businessCode??&&LMMCareProductVO.businessCode=="HOTEL"><option value="HOTEL" selected>酒店</option><#else><option value="HOTEL">酒店</option></#if>
														</select>
													</label>
													<button type="submit" class="btn btn-pink btn-sm" id="search"  style="margin-left: 30px;">
														<span class="ace-icon fa fa-search icon-on-right bigger-110"></span>查询
													</button>
													<label style="float: right;padding-right: 10px;cursor: pointer;">
														<span class="label label-lg label-success arrowed-right"  data-toggle="modal" data-target="#myModal03" id="newCareProduct" onclick="addNewCareProduct();">新增</span>
														<span class="label label-lg label-yellow arrowed-in arrowed-in-right"  id="export">导出</span>
														<span class="label label-lg label-purple arrowed" data-toggle="modal" data-target="#myModalInput">导入</span>
													</label>
												</div>
											</form>	
											
											<form action="${request.contextPath}/backConfig/export" id="exportForm" method="post" hidden="true">
												<input type="hidden" id="_csrf" name="${_csrf.parameterName}" value="${_csrf.token}" />
												<input id="productIdExport" name="productId" type="text" hidden="true">
												<input id="productNameExport" name="productName" type="text" hidden="true">
												<input id="cityNameExport" name="cityName" type="text" hidden="true">
												<input id="businessCodeExport" name=businessCode type="text" hidden="true">
												<button type="submit" hidden="true" id="exportExcel" class="btn btn-primary" ></button>
											</form>
										</div>
									</div>
								</div>
							</div>
							
							<div class="col-xs-12">
								<!-- 数据展示区域 -->
								<#if LMMCareProductVO??&&LMMCareProductVO.businessCode??&&LMMCareProductVO.businessCode=="TICKET">
									<#include "/background/config/ticket_ajax.html">
								<#elseif LMMCareProductVO??&&LMMCareProductVO.businessCode??&&LMMCareProductVO.businessCode=="HOTEL">
									<#include "/background/config/hotel_ajax.html">
								<#else>
								</#if>
								<#include "/paginator.html">
							</div>
						</div>
				</div>
				
				<!-- 产品导入 -->
				<div class="col-xs-12">
					<div class="file-box">
						<form id="uploadForm">
						<input type="hidden" id="_csrf" name="${_csrf.parameterName}" value="${_csrf.token}" />
						<div class="modal fade" id="myModalInput" tabindex="-1" role="dialog"
								aria-labelledby="myModalLabel" aria-hidden="true">
							<div class="modal-dialog">
								<div class="modal-content" style="width:400px; height:150px;">
									<div class="modal-header">
										<button type="button" class="close" data-dismiss="modal"
											aria-hidden="true">×</button>
										<h4 class="modal-title" id="myModalLabel"><strong>产品导入</strong></h4>
									</div>
									<div class="modal-body" id="productUrlDetail" style='word-break:break-all;'>
										<input type='text' name='textfield' id='textfield' class='txt' />
										<input type='button' class='view' value='浏览...' />
										<input type="file" name="file" class="file" id="fileField" size="28" onchange="document.getElementById('textfield').value=this.value" />
										<input type="button" onclick="doUpload(this)" class="view" value="上传" />
									</div>
								</div>
								<!-- /.modal-content -->
							</div>		
						</div>
						</form>
					</div> 
				</div>
				
				<div class="row">
					<div class="col-xs-12">
						<button class="btn btn-info" data-toggle="modal" type="button"
							style="display: none;" id="detailUrl" data-target="#myModal02">
						</button>
							<div class="modal fade" id="myModal02" tabindex="-1" role="dialog"
								aria-labelledby="myModalLabel" aria-hidden="true">
								<div class="modal-dialog">
									<div class="modal-content" style="width:800px; height:250px">
										<div class="modal-header">
											<button type="button" class="close" data-dismiss="modal"
												aria-hidden="true">×</button>
											<h4 class="modal-title" id="myModalLabel"><strong>详情链接</strong></h4>
										</div>
										<div class="modal-body" id="productUrlDetail1" style='word-break:break-all;'>
										</div>
									</div>
									<!-- /.modal-content -->
								</div>
								<!-- /.modal -->
							</div>
					</div>
				</div>
				<!-- 更新编码 -->
				<div class="row">
					<div class="col-xs-12">
						<button class="btn btn-info" data-toggle="modal" type="button"
							style="display: none;" id="updateProduct" data-target="#myModal01">
						</button>
						<form id="updateCode" class="form-horizontal" role="form" method='post' action="${request.contextPath}/backConfig/updateCareProduct">
							<input type="hidden" id="_csrf" name="${_csrf.parameterName}"
											value="${_csrf.token}" />
							<div class="modal fade" id="myModal01" tabindex="-1" role="dialog"
								aria-labelledby="myModalLabel" aria-hidden="true">
								<div class="modal-dialog">
									<div class="modal-content">
										<div class="modal-header">
											<button type="button" class="close" data-dismiss="modal"
												aria-hidden="true">×</button>
											<h4 class="modal-title" id="myModalLabel">产品配置</h4>
										</div>
										<div class="modal-body">
											<div class="space-4"></div>
											<div class="form-group">
												<div class="col-sm-9">											 
												    <div class="form-group">
														<label class="col-sm-3 control-label no-padding-right"
															for="form-field-1">产品ID</label>

														<div class="col-sm-9">
															<input type="text" id="productId" name="productId"
																placeholder="产品ID" class="form-control" readonly>
														</div>
													</div>
												    <div class="form-group">
														<label class="col-sm-3 control-label no-padding-right"
															for="form-field-1">产品名称</label>

														<div class="col-sm-9">
															<input type="text" id="productName" name="productName"
																placeholder="productName" class="form-control">
														</div>
													</div>
													<div class="form-group">
														<label class="col-sm-3 control-label no-padding-right"
															for="form-field-1">景点名称 </label>

														<div class="col-sm-9">
															<input type="text" id="actualName" name="actualName"
																placeholder="景点名称" class="form-control">
														</div>
													</div>
													<div class="form-group">
														<label class="col-sm-3 control-label no-padding-right"
															for="form-field-1">城市名称 </label>

														<div class="col-sm-9">
															<input type="text" id="cityName" name="cityName"
																placeholder="城市名称" class="form-control">
														</div>
													</div>
													<div class="form-group">
														<label class="col-sm-3 control-label no-padding-right"
															for="form-field-1">业务编码 </label>

														<div class="col-sm-9">
															<select name="businessCode" id="businessCode" aria-controls="dynamic-table" class="form-control input-sm" style="width:80px">
															      <option value="TICKET" selected>门票</option>
															      <option value="HOTEL">酒店</option>
															</select>
														</div>
													</div>
									
													<div class="form-group">
														<label class="col-sm-3 control-label no-padding-right"
															for="form-field-1">更新时间 </label>

														<div class="col-sm-9">
															<input type="text" id="updateTime" name="updateTime"
																placeholder="更新时间" class="form-control">
														</div>
													</div>
													<div class="form-group">
														<label class="col-sm-3 control-label no-padding-right"
															for="form-field-1">插入时间 </label>

														<div class="col-sm-9">
															<input type="text" id="insertTime" name="insertTime"
																placeholder="插入时间" class="form-control">
														</div>
													</div>
													<div class="form-group">
														<label class="col-sm-3 control-label no-padding-right"
															for="form-field-1"> XC名称</label>

														<div class="col-sm-9">
															<input type="text" id="xc_name" name="xc_name"
																placeholder="XC名称" class="form-control">
														</div>
													</div>
													<div class="form-group">
														<label class="col-sm-3 control-label no-padding-right"
															for="form-field-1"> XCUrl</label>

														<div class="col-sm-9">
															<input type="text" id="xc_url" name="xc_url"
																placeholder="XCUrl" class="form-control">
														</div>
													</div>
													<div class="form-group">
														<label class="col-sm-3 control-label no-padding-right"
															for="form-field-1"> TC名称</label>

														<div class="col-sm-9">
															<input type="text" id="tc_name" name="tc_name"
																placeholder="TC名称" class="form-control">
														</div>
													</div>
													<div class="form-group">
														<label class="col-sm-3 control-label no-padding-right"
															for="form-field-1"> TCUrl</label>

														<div class="col-sm-9">
															<input type="text" id="tc_url" name="tc_url"
																placeholder="TCUrl" class="form-control">
														</div>
													</div>
													<div class="form-group">
														<label class="col-sm-3 control-label no-padding-right"
															for="form-field-1"> TN名称</label>

														<div class="col-sm-9">
															<input type="text" id="tn_name" name="tn_name"
																placeholder="tn名称" class="form-control">
														</div>
													</div>
													<div class="form-group">
														<label class="col-sm-3 control-label no-padding-right"
															for="form-field-1"> TNUrl</label>

														<div class="col-sm-9">
															<input type="text" id="tn_url" name="tn_url"
																placeholder="TNUrl" class="form-control">
														</div>
													</div>
													<div class="form-group">
														<label class="col-sm-3 control-label no-padding-right"
															for="form-field-1"> QNR名称</label>

														<div class="col-sm-9">
															<input type="text" id="qnr_name" name="qnr_name"
																placeholder="QNR名称" class="form-control">
														</div>
													</div>
													<div class="form-group">
														<label class="col-sm-3 control-label no-padding-right"
															for="form-field-1"> QNRUrl</label>

														<div class="col-sm-9">
															<input type="text" id="qnr_url" name="qnr_url"
																placeholder="QNRUrl" class="form-control">
														</div>
													</div>
													<!-- add meituan -->

													<div class="form-group">
														<label class="col-sm-3 control-label no-padding-right"
															   for="form-field-1"> MT名称</label>

														<div class="col-sm-9">
															<input type="text" id="mt_name" name="mt_name"
																   placeholder="MT名称" class="form-control">
														</div>
													</div>
													<div class="form-group">
														<label class="col-sm-3 control-label no-padding-right"
															   for="form-field-1"> MTUrl</label>

														<div class="col-sm-9">
															<input type="text" id="mt_url" name="mt_url"
																   placeholder="MTUrl" class="form-control">
														</div>
													</div>

													<div id="ylmc_div" class="form-group" style="display:none">
														<label class="col-sm-3 control-label no-padding-right"
															   for="form-field-1"> EL名称</label>

														<div class="col-sm-9">
															<input type="text" id="yl_name_update" name="yl_name_update"
																   placeholder="YL名称" class="form-control">
														</div>
													</div>
													<div id="ylurl_div" class="form-group" style="display:none">
														<label class="col-sm-3 control-label no-padding-right"
															   for="form-field-1"> ELUrl</label>

														<div class="col-sm-9">
															<input type="text" id="yl_url_update" name="yl_url_update"
																   placeholder="YLUrl" class="form-control">
														</div>
													</div>
												</div>
											</div>
										</div>
										<div class="modal-footer">
											<button type="button" class="btn btn-pink btn-sm"
												data-dismiss="modal">关闭</button>
											<button type="button" class="btn btn-pink btn-sm" id="submitCareProductUpdate" data-dismiss="modal">
												提交</button>
										</div>
									</div>
									<!-- /.modal-content -->
								</div>
								<!-- /.modal -->
							</div>
						</form>
					</div>
				</div>
				
				<!-- 新增编码 -->
				<div class="row">
					<div class="col-xs-12">
						<button class="btn btn-info" data-toggle="modal" type="button"
							style="display: none;" id="newProduct" data-target="#myModal03">
						</button>
						<form id="updateCode" class="form-horizontal" role="form" method='post' action="${request.contextPath}/backConfig/newCareProduct">
							<input type="hidden" id="_csrf" name="${_csrf.parameterName}"
											value="${_csrf.token}" />
							<div class="modal fade" id="myModal03" tabindex="-1" role="dialog"
								aria-labelledby="myModalLabel" aria-hidden="true">
								<div class="modal-dialog">
									<div class="modal-content">
										<div class="modal-header">
											<button type="button" class="close" data-dismiss="modal"
												aria-hidden="true">×</button>
											<h4 class="modal-title" id="myModalLabel">产品配置</h4>
										</div>
										<div class="modal-body">

											<div class="space-4"></div>
											<div class="form-group">
												<div class="col-sm-9">											 
												    <div class="form-group">
														<label class="col-sm-3 control-label no-padding-right"
															for="form-field-1">产品ID</label>
														<div class="col-sm-7">
															<input type="text" id="nproductId" name="productId"
																placeholder="产品ID" class="form-control">
														</div>
														<div style="color:red" class="remind">*</div>
													</div>
												    <div class="form-group">
														<label class="col-sm-3 control-label no-padding-right"
															for="form-field-1">产品名称</label>

														<div class="col-sm-7">
															<input type="text" id="nproductName" name="productName"
																placeholder="产品名称" class="form-control">
														</div>
														<div style="color:red" class="remind" >*</div>
													</div>
													<div class="form-group">
														<label class="col-sm-3 control-label no-padding-right"
															for="form-field-1">景点名称 </label>

														<div class="col-sm-7">
															<input type="text" id="nactualName" name="actualName"
																placeholder="景点名称" class="form-control" >
														</div>
														<div style="color:red" class="remind">*</div>
													</div>
													<div class="form-group">
														<label class="col-sm-3 control-label no-padding-right"
															for="form-field-1">城市名称 </label>

														<div class="col-sm-7">
															<input  id="ncityName" name="cityName" placeholder="城市名称 "
																 class="form-control">
														</div>
														<div style="color:red" class="remind">*</div>
													</div>
													<div class="form-group">
														<label class="col-sm-3 control-label no-padding-right"
															for="form-field-1">业务编码 </label>

														<div class="col-sm-8">
															<select name="businessCode" id="nbusinessCode" aria-controls="dynamic-table" class="form-control input-sm" style="width:80px">
															      <option value="TICKET" selected>门票</option>
															      <option value="HOTEL">酒店</option>
															</select>
														</div>
													</div>
									
													<div class="form-group">
														<label class="col-sm-3 control-label no-padding-right"
															for="form-field-1">更新时间 </label>

														<div class="col-sm-9">
															<input type="text" id="nupdateTime" name="updateTime"
																placeholder="更新时间" class="form-control">
														</div>
													</div>
													<div class="form-group">
														<label class="col-sm-3 control-label no-padding-right"
															for="form-field-1">插入时间 </label>

														<div class="col-sm-9">
															<input type="text" id="ninsertTime" name="insertTime"
																placeholder="插入时间" class="form-control">
														</div>
													</div>
													<div class="form-group">
														<label class="col-sm-3 control-label no-padding-right"
															for="form-field-1"> XC名称</label>

														<div class="col-sm-9">
															<input type="text" id="nxc_name" name="xc_name"
																placeholder="XC名称" class="form-control">
														</div>
													</div>
													<div class="form-group">
														<label class="col-sm-3 control-label no-padding-right"
															for="form-field-1"> XCUrl</label>

														<div class="col-sm-9">
															<input type="text" id="nxc_url" name="xc_url"
																placeholder="XCUrl" class="form-control">
														</div>
													</div>
													<div class="form-group">
														<label class="col-sm-3 control-label no-padding-right"
															for="form-field-1"> TC名称</label>

														<div class="col-sm-9">
															<input type="text" id="ntc_name" name="tc_name"
																placeholder="TC名称" class="form-control">
														</div>
													</div>
													<div class="form-group">
														<label class="col-sm-3 control-label no-padding-right"
															for="form-field-1"> TCUrl</label>

														<div class="col-sm-9">
															<input type="text" id="ntc_url" name="tc_url"
																placeholder="TCUrl" class="form-control">
														</div>
													</div>
													<div class="form-group">
														<label class="col-sm-3 control-label no-padding-right"
															for="form-field-1"> TN名称</label>

														<div class="col-sm-9">
															<input type="text" id="ntn_name" name="tn_name"
																placeholder="tn名称" class="form-control">
														</div>
													</div>
													<div class="form-group">
														<label class="col-sm-3 control-label no-padding-right"
															for="form-field-1"> TNUrl</label>

														<div class="col-sm-9">
															<input type="text" id="ntn_url" name="tn_url"
																placeholder="TNUrl" class="form-control">
														</div>
													</div>
													<div class="form-group">
														<label class="col-sm-3 control-label no-padding-right"
															for="form-field-1"> QNR名称</label>

														<div class="col-sm-9">
															<input type="text" id="nqnr_name" name="qnr_name"
																placeholder="QNR名称" class="form-control">
														</div>
													</div>
													<div class="form-group">
														<label class="col-sm-3 control-label no-padding-right"
															for="form-field-1"> QNRUrl</label>

														<div class="col-sm-9">
															<input type="text" id="nqnr_url" name="qnr_url"
																placeholder="QNRUrl" class="form-control">
														</div>
													</div>
													<!-- add meituan -->
													<div class="form-group">
														<label class="col-sm-3 control-label no-padding-right"
															   for="form-field-1"> MT名称</label>

														<div class="col-sm-9">
															<input type="text" id="nmt_name" name="mt_name"
																   placeholder="MT名称" class="form-control">
														</div>
													</div>
													<div class="form-group">
														<label class="col-sm-3 control-label no-padding-right"
															   for="form-field-1"> MTUrl</label>

														<div class="col-sm-9">
															<input type="text" id="nmt_url" name="mt_url"
																   placeholder="MTUrl" class="form-control">
														</div>
													</div>

													<div id="ylmc_div_insert" class="form-group" style="display:none">
														<label class="col-sm-3 control-label no-padding-right"
															   for="form-field-1"> EL名称</label>

														<div class="col-sm-9">
															<input type="text" id="yl_name" name="yl_name"
																   placeholder="YL名称" class="form-control">
														</div>
													</div>
													<div id="ylurl_div_insert" class="form-group" style="display:none">
														<label class="col-sm-3 control-label no-padding-right"
															   for="form-field-1"> ELUrl</label>

														<div class="col-sm-9">
															<input type="text" id="yl_url" name="yl_url"
																   placeholder="YLUrl" class="form-control">
														</div>
													</div>
												</div>
											</div>
										</div>
										<div class="modal-footer">
											<button type="button" class="btn btn-pink btn-sm"
												data-dismiss="modal">关闭</button>
											<button type="submit" class="btn btn-pink btn-sm" id="new">
												提交</button>
										</div>
									</div>
									<!-- /.modal-content -->
								</div>
								<!-- /.modal -->
							</div>
						</form>
					</div>
				</div>
				
			</div>
		</div>
	</div> 
	<input type="hidden" id="cityError" value="${cityError!}"/>
	<input type="hidden" id="idError" value="${idError!}"/>
	<input type="hidden" id="prodConfigContext" value="${request.contextPath}"/>
	<script src="${request.contextPath}/static/assets/js/bootstrap.min.js"></script>
	<!-- page specific plugin scripts -->
	<script type="text/javascript" src="${request.contextPath}/static/javascripts/moment.js"></script>
	<script type="text/javascript" src="${request.contextPath}/static/javascripts/daterangepicker.js"></script>
	<script src="${request.contextPath}/static/assets/js/bootbox.js"></script>
	<!-- ace scripts -->
	<script src="${request.contextPath}/static/assets/js/jquery.gritter.min.js"></script>
	<script src="${request.contextPath}/static/assets/js/ace-elements.min.js"></script>
	<script src="${request.contextPath}/static/assets/js/ace.min.js"></script>
	<!-- user scripts -->
	<script src="${request.contextPath}/static/assets/js/user/base.js"></script>
	<script src="${request.contextPath}/static/assets/js/moment.min.js"></script>
	<script src="${request.contextPath}/static/assets/js/bootstrap-datepicker.min.js"></script>
	<script type="text/javascript" src="${request.contextPath}/static/javascripts/loading-incr.js"></script>
	<script type="text/javascript">
		
		prodConfigContext=$("#prodConfigContext").val();
		$("input[name=updateTime]").datepicker({
			format : "yyyy-mm-dd",
			autoclose : true
		});
		$("input[name=insertTime]").datepicker({
			format : "yyyy-mm-dd",
			autoclose : true
		});
		var showDetailUrl=function(obj){
			url=$(obj).attr('class');
			$("#productUrlDetail1").text("");
			$("#productUrlDetail1").text(url);
			$("#detailUrl").click();
		}
		var updateCareProduct=function(obj){
            $("#ylmc_div").hide();
            $("#ylurl_div").hide();
			productId=$(obj).parents("tr").find(".tdproductId").text();
			productName=$(obj).parents("tr").find(".tdProductName").text();
			actualName=$(obj).parents("tr").find(".tdActualName").text();
			cityName=$(obj).parents("tr").find(".tdActualName").next().text();
			cityCode=$(obj).parents("tr").find(".tdActualName").next().attr("class");
			businessCode="";
			businessName=$(obj).parents("tr").find(".tdBusinessCode").text().trim();
			if(businessName=='门票'){
				businessCode="TICKET";
			}else if(businessName=='酒店'){
				businessCode="HOTEL";
                yl_name=$(obj).parents("tr").find(".tdYLName").text();
                yl_url=$(obj).parents("tr").find(".tdYLUrl a").attr("class");
                $("#ylmc_div").show();
                $("#ylurl_div").show();
                $("#yl_name_update").val(yl_name);
                $("#yl_url_update").val(yl_url);
			}
			updateTime=$(obj).parents("tr").find(".tdUpdateTime").text();
			insertTime=$(obj).parents("tr").find(".tdInsertTime").text();
			xc_name=$(obj).parents("tr").find(".tdXCName").text();
			xc_url=$(obj).parents("tr").find(".tdXCUrl a").attr("class");
			tc_name=$(obj).parents("tr").find(".tdTCName").text();
			tc_url=$(obj).parents("tr").find(".tdTCUrl a").attr("class");
			tn_name=$(obj).parents("tr").find(".tdTNName").text();
			tn_url=$(obj).parents("tr").find(".tdTNUrl a").attr("class");
			qnr_name=$(obj).parents("tr").find(".tdQNRName").text();
			qnr_url=$(obj).parents("tr").find(".tdQNRUrl a").attr("class");
			//新增美团
            mt_name=$(obj).parents("tr").find(".tdMTName").text();
            mt_url=$(obj).parents("tr").find(".tdMTUrl a").attr("class");

			$("#productId").val(productId);
			$("#productName").val(productName);
			$("#actualName").val(actualName);
			$("#cityName").val(cityName);
			$("#businessCode").val(businessCode);
			$("#updateTime").val(updateTime);
			$("#insertTime").val(insertTime);
			$("#xc_name").val(xc_name);
			$("#xc_url").val(xc_url);
			$("#tc_name").val(tc_name);
			$("#tc_url").val(tc_url);
			$("#tn_name").val(tn_name);
			$("#tn_url").val(tn_url);
			$("#qnr_name").val(qnr_name);
			$("#qnr_url").val(qnr_url);
            $("#mt_name").val(mt_name);
            $("#mt_url").val(mt_url);
			
		}
		$("#submitCareProductUpdate").click(function(){
			//异步提交到后台
			$.ajax({
				url : prodConfigContext+'/backConfig/updateCareProduct',
				type : "GET",
				data : {
					productId:$("#productId").val(),
					productName:$("#productName").val(),
					actualName:$("#actualName").val(),
					cityName:$("#cityName").val(),
					//cityCode:$("#cityCode").val(),
					businessCode:$("#businessCode").val(),
					updateTime:$("#updateTime").val(),
					insertTime:$("#insertTime").val(),
					xc_name:$("#xc_name").val(),
					xc_url:$("#xc_url").val(),
					tc_name:$("#tc_name").val(),
					tc_url:$("#tc_url").val(),
					tn_name:$("#tn_name").val(),
					tn_url:$("#tn_url").val(),
                    qnr_name:$("#qnr_name").val(),
					qnr_url:$("#qnr_url").val(),
					mt_name:$("#mt_name").val(),
					mt_url:$("#mt_url").val(),
                    yl_name:$("#yl_name_update").val(),
                    yl_url:$("#yl_url_update").val()
				},
				success:function(data){
					cityInfo=data.cityError;
					if(cityInfo!=null){
						bootbox.alert("<strong style='padding-left:200px'>"+"请输入正确的城市名！"+"</strong>");
					}else{
						location.reload();
					}
				}
			});
		})
		var deleteCareProduct=function(obj){
			productId=$(obj).parents("tr").find(".tdproductId").text().trim();
			
			bootbox.confirm("<strong style='font-size:15px;padding-left:150px'>是否确认删除？</strong>", function(result){
				if(result){
					$.ajax({
						url : prodConfigContext+'/backConfig/deleteCareProduct',
						type : "GET",
						data : {
							productId:productId
						},
						success:function(data){
							//$(obj).parents("tr").remove();
							if(data.sessionStatus==540){//异步请求session过期状态
								window.location.href=prodConfigContext+"/login";
								//location.href="show_product?prodId="+prod_id+"&sceneryName="+tdSceneryName+"&pageNum="+$("#pageNum").val();
							}
							location.reload();
						}
					});
				}
			});
		};
		var addNewCareProduct=function(){
            $("#ylmc_div_insert").hide();
            $("#ylurl_div_insert").hide();
            businessCode=$("#businessCodeSearch").val();
            console.log(businessCode)
		    if(businessCode=="HOTEL")
			{
			    $("#ylmc_div_insert").show();
			    $("#ylurl_div_insert").show();
			}
		};
		var selectCityName=function(){
			$.ajax({
				url : prodConfigContext+'/backConfig/getCityCode',
				type : "GET",
				data : {
					cityName:ncityName
				},
				success:function(data){
					if(data.sessionStatus==540){//异步请求session过期状态
						window.location.href=prodConfigContext+"/login";
						//location.href="show_product?prodId="+prod_id+"&sceneryName="+tdSceneryName+"&pageNum="+$("#pageNum").val();
					}else if(data.cityCodes!=null&&data.cityCodes.size()>0){
						$.each(data.cityCodes,function(n,value){})
						$("#ncityCode").val(data.cityCode);
						$("#ncityName").append("<option></option>")
					}
					
				}
			});
		}
		
		$("#new").click(function(){
			var i=0;
			if($("#nproductId").val()==null||$("#nproductId").val()==""||$("#nproductId").val().trim()==""){
				$("#nproductId").parent().parent().find("div.remind").remove();
				$("#nproductId").parent().parent().append("<div style='color:red' class='remind'>产品ID不能为空</div>");
				i+=1;
			}
			if($("#nproductName").val()==null||$("#nproductName").val()==""||$("#nproductName").val().trim()==""){
				$("#nproductName").parent().parent().find("div.remind").remove();
				$("#nproductName").parent().parent().append("<div style='color:red' class='remind'>产品名称不能为空</div>");
				i+=1;
			}
			if($("#nactualName").val()==null||$("#nactualName").val()==""||$("#nactualName").val().trim()==""){
				$("#nactualName").parent().parent().find("div.remind").remove();
				$("#nactualName").parent().parent().append("<div style='color:red' class='remind'>景点名称不能为空</div>");
				i+=1;
			}
			if($("#ncityName").val()==null||$("#ncityName").val()==""||$("#ncityName").val().trim()==""){
				$("#ncityName").parent().parent().find("div.remind").remove();
				$("#ncityName").parent().parent().append("<div style='color:red' class='remind'>城市不能为空</div>");
				
				i+=1;
			}/*else{
				$.ajax({
					url : prodConfigContext+'/backConfig/getCityCode',
					type : "GET",
					data : {
						cityName:ncityName
					},
					success:function(data){
						if(data.cityCode!=null&&data.cityCode.length>0){
							$("#ncityCode").val(data.cityCode);
						}
						if(data.cityError!=null&&data.cityError.length>0){
							$("#ncityName").parent().parent().find("div.remind").remove();
							$("#ncityName").parent().parent().append("<div style='color:red' class='remind'>请输入正确的城市名</div>");
							
						}
					}
				});
			}*/
			if(i>0){
				return false;
			}
		});
		if($("#cityError").val()!=null&&$("#cityError").val().trim()!=""){
			bootbox.alert("<strong style='padding-left:200px'>"+"城市名不正确，新增 失败！"+"</strong>");
		}
		if($("#idError").val()!=null&&$("#idError").val().trim()!=""){
			bootbox.alert("<strong style='padding-left:200px'>"+$("#idError").val()+"</strong>");
		}
		
		$("#export").on("click",function(){
			var productId=$("#QueryProductId").val();
			var productName=$("#QueryProductName").val();
			var cityName=$("#QueryCityName").val();
			var businessCodeSearch=$("#businessCodeSearch").val();
			$("#productIdExport").val(productId);
			$("#productNameExport").val(productName);
			$("#cityNameExport").val(cityName);
			$("#businessCodeExport").val(businessCodeSearch);
			$("#exportExcel").click();
		});
		
		function doUpload(obj){
			var formData = new FormData($("#uploadForm")[0]);  
		    if($("#fileField").val().length==0){
		    	bootbox.alert("<strong style='padding-left:200px'>文件名不能为空</strong>");
		    	return;
		    }
			bootbox.confirm("<strong style='font-size:15px;'>上传过程需一段时间且会删除您的历史数据，确定上传吗？</strong>",function(result){
				if(result){
					 var formData = new FormData($("#uploadForm")[0]);  
				     if($("#fileField").val().length==0){
				    	 bootbox.alert("<strong style='padding-left:200px'>文件名不能为空</strong>");
				    	 return;
				     }
				     if($(".fade")){
				    	 	$(".fade").css("display","none")
				      	  	openPartialLayer($("#loadingdiv"));
				     	  	setTimeout(function(){	
				                  $.ajax({
				                       url: prodConfigContext+"/backConfig/input/",
				                       type: 'POST',  
				                       data: formData,  
				                       async: false,  
				                       cache: false,  
				                       contentType: false,  
				                       processData: false,  
				                       beforeSend: function () {
				                             $(obj).attr("disabled", true);
				                         },
				                         complete: function () {
				                             $(obj).attr("disabled", false);
				                         },
				                       success: function (data) {  
				                           if(data.inputSuccess!=null){
				                             bootbox.alert("<strong style='padding-left:200px'>"+data.inputSuccess+"</strong>");
				                             location.reload();
				                           } 
				                           //alert(data.inputError);
				                           if(data.inputError!=null){
				                             bootbox.alert("<strong style='padding-left:120px'>"+data.inputError+"</strong>");
				                           } 
				                           fileUploadDone="false";
				                       },  
				                       error: function (data) {  
				                         bootbox.alert("<strong style='padding-left:200px'>上传失败</strong>");  
				                         fileUploadDone="false";
				                       }  
				                  });
				     	  	},50)
				     }	     
				}
				});
		}
	</script>
</body>
</html>